﻿/*
 * ©2009-2010 XELF
 * http://xelf.info
 */

using System;

#if XNA || WINDOWS_PHONE
using Microsoft.Xna.Framework;
#endif

namespace XELF.Framework {

#if XNA || WINDOWS_PHONE
	public static partial class Vector3Helper {
#else
	public partial struct Vector3 {
#endif
		/// <summary>
		/// 成分別の最小値。
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <param name="result"></param>
		public static void Min(ref Vector3 a, ref Vector3 b, out Vector3 result) {
			result = new Vector3(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y), Math.Min(a.Z, b.Z));
		}

		/// <summary>
		/// 成分別の最大値。
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <param name="result"></param>
		public static void Max(ref Vector3 a, ref Vector3 b, out Vector3 result) {
			result = new Vector3(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y), Math.Max(a.Z, b.Z));
		}

#if XNA || WINDOWS_PHONE
		/// <summary>
		/// 最大の成分の値。
		/// </summary>
		/// <returns></returns>
		public static float Max(this Vector3 @this) {
			return Math.Max(Math.Max(@this.X, @this.Y), @this.Z);
		}

		/// <summary>
		/// 最小の成分の値。
		/// </summary>
		/// <returns></returns>
		public static float Min(this Vector3 @this) {
			return Math.Min(Math.Min(@this.X, @this.Y), @this.Z);
		}
#else
		/// <summary>
		/// 最大の成分の値。
		/// </summary>
		/// <returns></returns>
		public float Max() {
			return Math.Max(Math.Max(X, Y), Z);
		}

		/// <summary>
		/// 最小の成分の値。
		/// </summary>
		/// <returns></returns>
		public float Min() {
			return Math.Min(Math.Min(X, Y), Z);
		}
#endif
	}

}
